//
//  LHRecommendTourNotesViewController.m
//  Knight_Tour
//
//  Created by Bruce_Lin on 15/5/13.
//  Copyright (c) 2015年 TouchOne. All rights reserved.
//

#import "LHRecommendTourNotesViewController.h"
#import "LHRecommendTourNotesView.h"
#import "MyNavgationView.h"
#import "LHRecommendTourNotesDetailViewController.h"
#import "LHRecommendTravelNotesModel.h"
#import "LHNetworkHandle.h"
#import "LHRecommendTravelNotesDetailModel.h"

@interface LHRecommendTourNotesViewController ()<jumpToNotesDetailDelegate>


@property (nonatomic, retain) NSMutableArray *notesDetailArr;
@property (nonatomic, retain) LHRecommendTourNotesView *tourNotesView;

@end

@implementation LHRecommendTourNotesViewController

- (void)dealloc
{
    [_notesDetailArr release];
    [_tourNotesView release];
    [super dealloc];
}


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.navigationController.navigationBar.translucent = NO;
    self.navigationController.navigationBarHidden = YES;
    
    self.automaticallyAdjustsScrollViewInsets = NO;
    
    [self createTourNotesView];
    [self createNavigation];
    
}

// 创建推荐游记页面
- (void)createTourNotesView
{
    self.tourNotesView = [[LHRecommendTourNotesView alloc] initWithFrame:CGRectMake(0, 64, self.view.frame.size.width, self.view.frame.size.height - 64)];
    
    _tourNotesView.delegate = self;
    
    [self.view addSubview:_tourNotesView];
    
    [_tourNotesView release];
    
}

// 实现协议方法
- (void)jumpToNotesDetailViewWithIndexPath:(NSIndexPath *)indexPath tourNotesArr:(NSMutableArray *)tourNotesArr
{
    LHRecommendTourNotesDetailViewController *noteDetailView = [[LHRecommendTourNotesDetailViewController alloc] init];
    
    noteDetailView.notesDetail_id = [tourNotesArr[indexPath.row] notesId];

    noteDetailView.notesName = [tourNotesArr[indexPath.row] name];
    
    [self.navigationController pushViewController:noteDetailView animated:YES];
    
    [noteDetailView release];
    
}

// 创建自定义导航栏
- (void)createNavigation
{
    MyNavgationView *myNaView = [[MyNavgationView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 64)];
    
    [myNaView creatTitle:@"游记"];
    
    myNaView.leftTarget = self;
    myNaView.leftAction = @selector(backToRecommendHomePage);
    [myNaView creatLeftButtonWithImage:@"btn_nav_back"];
    
    [self.view addSubview:myNaView];
    
    [myNaView release];
    
}

/**
 *  实现跳转回推荐游主页
 */

- (void)backToRecommendHomePage
{
    [self.navigationController popViewControllerAnimated:YES];
}





- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
